﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Diagnostics;

namespace SMBCFamilyAssessment.Models
{

    
    //public class AssessmentDatabaseInitializer : DropCreateDatabaseAlways<AssessmentContext>
    public class AssessmentDatabaseInitializer : DropCreateDatabaseIfModelChanges<AssessmentContext>
    {


        protected override void Seed(AssessmentContext context)
        {


            //try
            //{
            //    List<Family> fList = GetFamilies();
            //    List<Person> pList = GetPersons();
            //    List<Questionset> qsList = GetQuestionset();
            //    List<Question> qList = GetQuestions();
            //    //List<Assessment> aList = GetAssessments();
            //    foreach (Family f in fList)
            //    {


            //        context.Families.Add(f);


            //    }

            //    foreach (Person p in pList)
            //    {


            //        context.Persons.Add(p);


            //    }

            //    foreach (Questionset qs in qsList)
            //    {


            //        context.Questionsets.Add(qs);


            //    }

            //    foreach (Question q in qList)
            //    {

            //        context.Questions.Add(q);


            //    }



            //    //foreach (Assessment a in aList)
            //    //{


            //    //    context.Assessments.Add(a);


            //    //}


            //    context.SaveChanges();


            //}

            //catch (Exception e)
            //{

            //    Debug.Write(e.Message);

            //}



        }


        //private static List<Family> GetFamilies()
        //{

        //    var Families = new List<Family>{
        //        new Family
        //        {
        //            Id=1,
        //            Address1="Council House",
        //            Address2="Manor Square",
        //            PostCode="B91 3QS",
        //            Town="Solihull",
        //            PrimaryPhoneNumber="01217046000",
        //            CreatedBy="Admin",
        //            CreatedDateTime=DateTime.Now
                 
        //        },

        //        new Family
        //        {
        //            Id=2,
        //            Address1="xxxx",
        //            Address2="yyyy",
        //            PostCode="B91 3QS",
        //            Town="Solihull",
        //            PrimaryPhoneNumber="01217046000",
        //             CreatedBy="Admin",
        //            CreatedDateTime=DateTime.Now
        //        },
        //        new Family
        //        {
        //            Id=3,
        //            Address1="aaaaa",
        //            Address2="bbbbb",
        //            PostCode="B91 3QS",
        //            Town="Solihull",
        //            PrimaryPhoneNumber="01217046000",
        //          CreatedBy="Admin",
        //            CreatedDateTime=DateTime.Now
        //        },
                
        //    };
        //    return Families;






        //}

        //private static List<Person> GetPersons()
        //{
        //    var Persons = new List<Person>{
        //        new Person
        //        {
        //            Id=1,

        //            FirstName="James",
        //            Surname="Bond",
        //            DOB=new DateTime(1969,2,2,0,0,0),
        //             CreatedBy="Admin",
        //            CreatedDateTime=DateTime.Now
                    
                 
        //        },

        //             new Person
        //        {
        //            Id=2,
 
        //            FirstName="Angelina",
        //            Surname="Julie",
        //            DOB=new DateTime(1979,3,12,0,0,0),
                    
        //          CreatedBy="Admin",
        //            CreatedDateTime=DateTime.Now
        //        },

        //            new Person
        //        {
        //            Id=3,
       
        //            FirstName="Brian",
        //            Surname="Lara",
        //            DOB=new DateTime(1989,4,12,0,0,0),
        //             CreatedBy="Admin",
        //            CreatedDateTime=DateTime.Now
                 
        //        },

        //             new Person
        //        {
        //            Id=4,
              
        //            FirstName="Wasim",
        //            Surname="Akram",
        //            DOB=new DateTime(1968,5,21,0,0,0) ,
        //             CreatedBy="Admin",
        //            CreatedDateTime=DateTime.Now
        //        },

        //              new Person
        //        {
        //            Id=5,
                   
        //            FirstName="Bill",
        //            Surname="Gates",
        //            DOB=new DateTime(1958,6,22,0,0,0),
        //             CreatedBy="Admin",
        //            CreatedDateTime=DateTime.Now
                    
                 
        //        },

        //                    new Person
        //        {
        //            Id=6,
                 
        //            FirstName="George",
        //            Surname="Oshbourne",
        //            DOB=new DateTime(1974,8,1,0,0,0),
        //             CreatedBy="Admin",
        //            CreatedDateTime=DateTime.Now
                    
                 
        //        },


             
        //    };
        //    return Persons;

        //}




        //private static List<Questionset> GetQuestionset()
        //{
        //    var Questionsets = new List<Questionset>{
        //       new Questionset
        //       {
                   
             
        //         Id=1,
        //           CreatedBy="Admin",
        //           CreatedDateTime=DateTime.Now,
        //           CategoryDescription="Community",
        //           LastModifiedBy="Admin"



        //       },
        //       new Questionset
        //       {

        //           Id=2,
        //           CreatedBy="Admin",
        //           CreatedDateTime=DateTime.Now,
        //           CategoryDescription="Employment",
        //           LastModifiedBy="Admin"
        //       },
        //       new Questionset
        //       {

        //           Id=3,
        //           CreatedBy="Admin",
        //           CreatedDateTime=DateTime.Now,
        //           CategoryDescription="Health",
        //           LastModifiedBy="Admin"
        //       },

              
        //   };
        //    return Questionsets;

        //}

        //private static List<Question> GetQuestions()
        //{
        //    var Questions = new List<Question>{

        //        new Question
        //        {
        //            Id=1,
               
        //            Description="Neighbourhood Relationships",
        //            CreatedBy="Admin",
                
        //            CreatedDateTime=DateTime.Now
                    
        //        },
        //         new Question
        //        {
        //            Id=1,
        
        //            Description="I feel safe at home",
        //            CreatedBy="Admin",
                
        //            CreatedDateTime=DateTime.Now
                    
        //        },


        //            new Question
        //        {
        //            Id=2,

        //            Description="Education is important",
        //            CreatedBy="Admin"  ,
                
        //            CreatedDateTime=DateTime.Now              },
        //         new Question
        //        {
        //            Id=2,
     
        //            Description="Prepared for training",
        //            CreatedBy="Admin",
                
        //            CreatedDateTime=DateTime.Now
                    
        //        },

        //            new Question
        //        {
        //            Id=3,
           
        //            Description="I feel stressed",
        //            CreatedBy="Admin",
                
        //            CreatedDateTime=DateTime.Now
                    
        //        },
        //         new Question
        //        {
        //            Id=3,
           
        //            Description="Hygine is important",
        //            CreatedBy="Admin",
                
        //            CreatedDateTime=DateTime.Now
                    
        //        },





        //    };

        //    return Questions;

        //}
  //      private static List<Assessment> GetAssessments()
  //      {
  //          var Assessments = new List<Assessment>{

  //              new Assessment
  //              {
                
  //              //Id=1,
  //              Id=1,
  //              AssessmentID=1,
  //              //Id=1,
  //              QuestionID=1,
  //              Score=4,
  //              CreatedBy="Admin",
  //              CreatedDateTime=DateTime.Now,
  //              Notes="First assessment question positive response"
                
                
  //              },


  //               new Assessment
  //              {
  //              //Id=1,
  //              Id=1,   
  //              AssessmentID=1,
  //              //Id=1,
  //              QuestionID=2,
  //              Score=3,
  //              CreatedBy="Admin",
  //              CreatedDateTime=DateTime.Now,
  //              Notes="First assessment question positive response"
                
                
  //              },




  //               new Assessment
  //              {
                   
  //               //Id=1,
  //              Id=1,
  //              AssessmentID=1,
  //              //Id=1,
  //              QuestionID=3,
  //              Score=5,
  //              CreatedBy="Admin",
  //              CreatedDateTime=DateTime.Now,
  //              Notes="First assessment question positive response"
                
                
  //              },





  //               new Assessment
  //              {
  //               //Id=1,
  //              Id=1,   
  //              AssessmentID=1,
  //              //Id=2,
  //              QuestionID=1,
  //              Score=3,
  //              CreatedBy="Admin",
  //              CreatedDateTime=DateTime.Now,
  //              Notes="First assessment question positive response"
                
                
  //              },



  //               new Assessment
  //              {
  //                  //Id=1,
  //              Id=1,
  //              AssessmentID=1,
  //              //Id=2,
  //              QuestionID=2,
  //              Score=3,
  //              CreatedBy="Admin",
  //              CreatedDateTime=DateTime.Now,
  //              Notes="First assessment question positive response"
                
                
  //              },


  //               new Assessment
  //              {
  //                  //Id=1,
  //              Id=1,
  //              AssessmentID=1,
  //              //Id=2,
  //              QuestionID=3,
  //              Score=4,
  //              CreatedBy="Admin",
  //              CreatedDateTime=DateTime.Now,
  //              Notes="First assessment question positive response"
                
                
  //              },

  //               new Assessment
  //              {
  //                  //Id=1,
  //              Id=1,
  //              AssessmentID=1,
  //              //Id=3,
  //              QuestionID=1,
  //              Score=4,
  //              CreatedBy="Admin",
  //              CreatedDateTime=DateTime.Now,
  //              Notes="First assessment question positive response"
                
                
  //              },
  //               new Assessment
  //              {
  //                  //Id=1,
  //              Id=1,
  //              AssessmentID=1,
  //             // Id=3,
  //              QuestionID=2,
  //              Score=4,
  //              CreatedBy="Admin",
  //              CreatedDateTime=DateTime.Now,
  //              Notes="First assessment question positive response"
                
                
  //              },
  //               new Assessment
  //              {
  //               //   Id=1,
  //              Id=1,
  //              AssessmentID=1,
  //              //Id=3,
  //              QuestionID=3,
  //              Score=4,
  //              CreatedBy="Admin",
  //              CreatedDateTime=DateTime.Now,
  //              Notes="First assessment question positive response"
                
                
  //              },
  //               new Assessment
  //              {
  //                //  Id=1,
  //              Id=1,
  //              AssessmentID=2,
  //              //Id=1,
  //              QuestionID=1,
  //              Score=8,
  //              CreatedBy="Admin",
  //              CreatedDateTime=DateTime.Now.AddDays(-15),
  //              Notes="First assessment question positive response"
                
                
  //              },
  //               new Assessment
  //              {
  //                 // Id=1,
  //              Id=1,
  //              AssessmentID=2,
  //              //Id=1,
  //              QuestionID=2,
  //              Score=6,
  //              CreatedBy="Admin",
  //   CreatedDateTime=DateTime.Now.AddDays(-15),
  //              Notes="First assessment question positive response"
                
                
  //              },

  //                new Assessment
  //              {
  //                //  Id=1,
  //              Id=1,
  //              AssessmentID=2,
  //              //Id=1,
  //              QuestionID=3,
  //              Score=4,
  //              CreatedBy="Admin",
  //               CreatedDateTime=DateTime.Now.AddDays(-15),
  //              Notes="First assessment question positive response"
                
                
  //              },
  //new Assessment
  //              {
  //                //  Id=1,
  //              Id=1,
  //              AssessmentID=2,
  //              //Id=2,
  //              QuestionID=1,
  //              Score=7,
  //              CreatedBy="Admin",
  //             CreatedDateTime=DateTime.Now.AddDays(-15),
  //              Notes="First assessment question positive response"
                
                
  //              },
  //new Assessment
  //              {
  //                //  Id=1,
  //              Id=1,
  //              AssessmentID=2,
  //              //Id=2,
  //              QuestionID=2,
  //              Score=6,
  //              CreatedBy="Admin",
  //            CreatedDateTime=DateTime.Now.AddDays(-15),
  //              Notes="First assessment question positive response"
                
                
  //              },
  //new Assessment
  //              {
  //                //  Id=1,
  //              Id=1,
  //              AssessmentID=2,
  //              //Id=2,
  //              QuestionID=3,
  //              Score=2,
  //              CreatedBy="Admin",
  //              CreatedDateTime=DateTime.Now.AddDays(-15),
  //              Notes="First assessment question positive response"
                
                
  //              },
        
  //                new Assessment
  //              {
  //                //  Id=1,
  //              Id=1,
  //              AssessmentID=2,
  //              //Id=3,
  //              QuestionID=1,
  //              Score=9,
  //              CreatedBy="Admin",
  //                CreatedDateTime=DateTime.Now.AddDays(-15),
  //              Notes="First assessment question positive response"
                
                
  //              },


  //                new Assessment
  //              {
  //                //  Id=1,
  //              Id=1,
  //              AssessmentID=2,
  //              //Id=3,
  //              QuestionID=2,
  //              Score=5,
  //              CreatedBy="Admin",
  //              CreatedDateTime=DateTime.Now.AddDays(-15),
  //              Notes="First assessment question positive response"
                
                
  //              },


  //                new Assessment
  //              {
  //                //  Id=1,
  //              Id=1,
  //              AssessmentID=2,
  //              //Id=3,
  //              QuestionID=3,
  //              Score=1,
  //              CreatedBy="Admin",
  //              CreatedDateTime=DateTime.Now.AddDays(-15),
  //              Notes="First assessment question positive response"
                
                
  //              },





                


  //          };

  //          return Assessments;




  //      }







  }
}